{% extends "base.html" %}

{% block js %}

<script src="/static/js/ajax.js"></script>

<script type="text/javascript" charset="utf-8">
$(document).ready(function(){

$('.delete').click(function(){
    obj = $(this);
    doPost(obj, obj.attr('herf'));
    return false;
});

});
</script>
{% endblock %}

{% block menu %}
{% if login and user.type == 2 %}
<a href="/create/contact">新建联系人</a>
{% endif %}
<table>
    <tr>
        <th>姓名</th><th>公司</th><th>电话</th><th>邮箱</th>
    </tr>
{% for contact in contacts %}
    <tr>
        <td>{{contact.name}}</td><td>{{contact.company}}</td><td>{{contact.phone}}</td><td>{{contact.email}}</td>
        {% if login and user.type == 2 %}<td><a class="delete" herf="/delete/contact/{{contact.id}}">删除</td>{% endif %}
    </tr>
{% endfor %}
</table>
{% endblock %}

{% block content %}
{% endblock %}
